<?php
namespace Common\Common;
class Tree{
    
    public $tempArr = array();
    public function reform($category,$fid=0,$cn=0)
    {
        $cn++;
        // $temp = array();
        foreach ($category as $v) {

            if($v['fid']==$fid){
                $v['cname'] = str_repeat('——',($cn-1)).$v['cname'].'('.$cn.'分类)';
                $this->tempArr[]=$v;
                $this->reform($category,$v['id'],$cn);
            }
        }

        return $this->tempArr;
    }
}